***** First run "Clean Dataset" and then "dofile2"   *******
// Includes code for Table 2 and Table E.2

stack idk3_1 genk2_1 totscorek2_1 chosen2_1 rankk2_1 sex id rankchos ///
idk3_2 genk2_2 totscorek2_2 chosen2_2 rankk2_2 sex id rankchos ///
idk3_3 genk2_3 totscorek2_3 chosen2_3 rankk2_3 sex id rankchos ///
idk3_4 genk2_4 totscorek2_4 chosen2_4 rankk2_4 sex id rankchos, ///
into(idk gen totscore chosen rank sex id rankchos) clear

label variable gen "Female" 
label variable totscore "Score"
label var chosen "Chosen"
label var rank "Rank"

******** Table 2   ***********
clogit chosen gen , group(id) robust or
qui est sto z

 clogit chosen gen totscore, group(id) robust or
qui est sto p

 
esttab z p  using table4.tex, eform se star(* 0.10 ** 0.05 *** 0.01)  /// 
label title("Probability of being chosen") ///
nodepvars nomtitles nonotes ///  
addnotes ///
("Notes: Clogit regression. The dependent variable is chosen" ///
"candidate. The table reports odds ratios, robust standard" ///
"errors in parenthesis. *,**, and *** denote significance at the 10%," /// 
"5% and 1% level. The lower panel indicates the number of observations.") ///
gap eqlabels(none) collabels(,lhs(Dep Var: Fem Chos)) replace


******* Table E.2    **********

reg chosen gen, cluster(idk) robust
est sto q

reg chosen gen totscore, cluster(idk)  robust
est sto k

esttab q k  using table3_ols.tex,  ci star(* 0.10 ** 0.05 *** 0.01)  /// 
label title("Probability of being chosen") ///
nodepvars nomtitles nonotes ///  
addnotes ///
("Notes: Clogit regression. The dependent variable is chosen" ///
"candidate. The table reports odds ratios, robust standard" ///
"errors in parenthesis. *,**, and *** denote significance at the 10%," /// 
"5% and 1% level. The lower panel indicates the number of observations.") ///
gap eqlabels(none) collabels(,lhs(Dep Var: Fem Chos)) replace


